from periphery import PWM
import time

# 打开PWM芯片
#pwm = PWM(0, 0)
#pwm = PWM(1, 0)
pwm = PWM(2, 0)

# 设置频率为100Hz
pwm.frequency = 100

# 设置极性为正常
pwm.polarity = "normal"

# 设置占空比为0
pwm.duty_cycle = 0

# 启用PWM
pwm.enable()

# 改变占空比
pwm.duty_cycle = 0.5
time.sleep(5)

# 关闭PWM
pwm.duty_cycle = 0
pwm.close()

